﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace GameSchool.Models
{
	public class AssignmentRepository
	{
		AssignmentDBContextDataContext db = new AssignmentDBContextDataContext();

		// Skila lista af öllum verkefnum
		public IEnumerable<Assignment> Assignments()
		{
			return db.Assignments;
		}

		// Vista breytingar
		public void Save()
		{
			db.SubmitChanges();
		}

		// Bæta við verkefni
		public void Add(Assignment newAssignment)
		{
			db.Assignments.InsertOnSubmit(newAssignment);
		}

		// Eyða verkefni
		public void Delete(Assignment deleteAssignment)
		{
			db.Assignments.DeleteOnSubmit(deleteAssignment);
		}
	}
}